<?php
session_start();
require('../conn.php');
require('../functions.php');
if ($_SESSION['admin'] == 1) {
    _location("ucenter.php", 'js');
    exit;
}
if ($_POST) {
    $username = guolv(trim($_POST['username']));
    $password = guolv(trim($_POST['password']));
    $yzm = guolv(trim($_POST['yzm']));
    if ($username !== '' & $password !== '') {
        $row = $mysql->query("select * from `admindata` where `username`='{$username}' and `password`='{$password}' limit 1");
//        var_dump($row);exit;
        if ($row) {
            $_SESSION['admin'] = 1;
            $_SESSION['admindata'] = $row[0];
            _location('ucenter.php', 301);
            exit;
        }
    }
} ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap-responsive.css">
    <link rel="stylesheet" type="text/css" href="stylesheets/theme.css">
    <link rel="stylesheet" href="lib/font-awesome/css/font-awesome.css">

    <script src="<?php echo $jquerysite ?>" type="text/javascript"></script>

    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height: 300px;
            width: 800px;
            margin: 0px auto;
            margin-top: 1em;
        }

        .brand {
            font-family: georgia, serif;
        }

        .brand .first {
            color: #ccc;
            font-style: italic;
        }

        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
</head>

<!--[if lt IE 7 ]>
<body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]>
<body class="ie ie7"> <![endif]-->
<!--[if IE 8 ]>
<body class="ie ie8"> <![endif]-->
<!--[if IE 9 ]>
<body class="ie ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<body>
<!--<![endif]-->

<div class="navbar">
    <div class="navbar-inner">
        <div class="container-fluid">
            <ul class="nav pull-right">

            </ul>
            <a class="brand" href="#"><span class="second">管理系统</span></a>
        </div>
    </div>
</div>


<div class="container-fluid">

    <div class="row-fluid">
        <div class="dialog span4">
            <div class="block">
                <div class="block-heading">登陆</div>
                <div class="block-body">
                    <form action="" method="post">
                        <label>用户名</label>
                        <input name="username" type="text" class="span12" value="" id="username" autocomplete="off">
                        <label>密码</label>
                        <input name="password" type="password" class="span12" value="" id="password" autocomplete="off">
                        <button type="submit" class="btn btn-primary pull-right">登陆</button>
                        <div class="clearfix"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>


    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="lib/bootstrap/js/bootstrap.js"></script>
    <script src="<?php echo $jquerysite ?>"></script>

    <script>
        $(document).ready(function () {
            $("button").click(function () {
                var _username = $("#username").val();
                var _password = $("#password").val();
                $.post("login.php",
                    {
                        username: _username,
                        password: _password,
                    },
                    function (data, status) {
                        //alert("数据：" + data + "\n状态：" + status);
                    });
            });
        });
    </script>


</body>
</html>
